from sqlalchemy import Column, text
from sqlalchemy.dialects.mysql import INTEGER, TINYINT
from field_types.base_types import String
from models.base_model import StandardizedBase


class Application(StandardizedBase):
    __tablename__ = 'application'

    id = Column(INTEGER(11), primary_key=True)
    guid = Column(String(40, 'utf8mb4_unicode_ci'))
    name = Column(String(40, 'utf8mb4_unicode_ci'))
    app_id = Column(String(40, 'utf8mb4_unicode_ci'))
    server_secret = Column(String(256, 'utf8mb4_unicode_ci'))
    function_ids_str = Column(String(512, 'utf8mb4_unicode_ci'))
    is_disable = Column(TINYINT(1), server_default=text("'0'"))

    create_time = Column(INTEGER(11))
    create_user_id = Column(INTEGER(11))
    last_update_time = Column(INTEGER(11))
    last_update_user_id = Column(INTEGER(11))
    is_delete = Column(TINYINT(1), server_default=text("'0'"))